<admintpl file="header" />
</head>
<body>
	<div class="wrap">
		<ul class="nav nav-tabs">
			<li><a href="{:U('user/index')}">{:L('ADMIN_USER_INDEX')}</a></li>
			<li><a href="{:U('user/add')}">{:L('ADMIN_USER_ADD')}</a></li>
			<li class="active"><a>编辑管理员</a></li>
		</ul>
		<form method="post" class="form-horizontal js-ajax-form" action="{:U('User/edit_post')}">
			<fieldset>
				<div class="control-group">
					<label class="control-label">{:L('USERNAME')}</label>
					<div class="controls">
						<input type="text" name="user_login" value="{$user_login}">
					</div>
				</div>
				<div class="control-group">
					<label class="control-label">{:L('PASSWORD')}</label>
					<div class="controls">
						<input type="password" name="user_pass" value="" placeholder="******">
					</div>
				</div>
				<div class="control-group">
					<label class="control-label">姓名</label>
					<div class="controls">
						<input type="text" name="user_nicename" value="{$user_nicename}">
					</div>
				</div>
				<div class="control-group">
					<label class="control-label">手机号</label>
					<div class="controls">
						<input type="text" name="user_phone" value="{$user_phone}">
					</div>
				</div>
				<!--<div class="control-group">-->
					<!--<label class="control-label">{:L('EMAIL')}</label>-->
					<!--<div class="controls">-->
						<!--<input type="text" name="user_email" value="{$user_email}">-->
					<!--</div>-->
				<!--</div>-->
				<div class="control-group">
					<label class="control-label">{:L('ROLE')}</label>
					<div class="controls">
						<foreach name="roles" item="vo">
							<if condition="$vo['id'] != 1  && $vo['id'] != 5">
						<label class="checkbox inline">
							<php>$role_id_checked=in_array($vo['id'],$role_ids)?"checked":"";</php>
							<input value="{$vo.id}" type="radio" name="role_id" onchange="change_role()" {$role_id_checked} <if condition="sp_get_current_admin_id() neq 1 && $vo['id'] eq 1">disabled="true"</if>>{$vo.name}
						</label>
								</if>
						</foreach>
					</div>
				</div>
				<div class="control-group logistics_list" <if condition="$model != 2">style="display: none;"</if>>
					<label class="control-label">物流公司</label>
					<div class="controls">
						<select name="organize_id1">
							<option value="">请选择</option>
							<foreach name="logistics_list" item="litem">
								<option value="{$litem['id']}" <if condition="$model == 2 && $litem['id'] == $organize_id">selected</if>>{$litem.logistics_name}</option>
							</foreach>
						</select>
					</div>
				</div>


				<div class="control-group sale_manager_list" <if condition="$model != 6">style="display: none;"</if>>
					<label class="control-label">上级消费机构</label>
					<div class="controls">
						<select name="organize_id3">
							<option value="">请选择</option>
							<foreach name="sale_manager_list" item="smitem">
								<option value="{$smitem['id']}"  <if condition="$model == 6 && $smitem['id'] == $organize_id">selected</if>>{$smitem.sale_manage_name}</option>
							</foreach>
						</select>
					</div>
				</div>

				<div class="control-group sale_list" <if condition="$model != 3">style="display: none;"</if>>
					<label class="control-label">消费机构</label>
					<div class="controls">
						<select name="organize_id2">
							<option value="">请选择</option>
							<foreach name="sale_list" item="sitem">
								<option value="{$sitem['id']}"  <if condition="$model == 3 && $sitem['id'] == $organize_id">selected</if>>{$sitem.sale_name}</option>
							</foreach>
						</select>
					</div>
				</div>
			</fieldset>
			<div class="form-actions">
				<input type="hidden" name="id" value="{$id}" />
				<input type="hidden" name="model" value="{$model}"/>
				<button type="submit" class="btn btn-primary js-ajax-submit">{:L('SAVE')}</button>
				<a class="btn" href="javascript:history.back(-1);">{:L('BACK')}</a>
			</div>
		</form>
	</div>
	<script src="__PUBLIC__/js/common.js"></script>
	<script>
		function change_role(){
			var role_id = $("input[name='role_id']:checked").val();
			console.log(role_id);
			if(role_id  == 3){	//消费机构
				$(".sale_list").show();
				$(".logistics_list").hide();
				$(".sale_manager_list").hide();
			}else if(role_id == 2){	//物流公司
				$(".sale_list").hide();
				$(".sale_manager_list").hide();
				$(".logistics_list").show();
			}else if(role_id == 6){
				$(".sale_manager_list").show();
				$(".sale_list").hide();
				$(".logistics_list").hide();
			}else{	//管理员
				$(".sale_list").hide();
				$(".logistics_list").hide();
				$(".sale_manager_list").hide();
			}
			$("input[name='model']").val(role_id);
		}
	</script>
</body>
</html>